package com.europe.business.europebusiness.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.europe.business.europebusiness.R;
import com.europe.business.europebusiness.ui.activity.FeedbackActivity;
import com.europe.business.europebusiness.ui.activity.HelpActivity;
import com.europe.business.europebusiness.ui.activity.InformationActivity;
import com.europe.business.europebusiness.ui.activity.SettingActivity;
import com.europe.business.europebusiness.ui.activity.VipActivity;
import com.europe.business.europebusiness.ui.fragment.base.ActionBarFragment;

public class MyFragment extends ActionBarFragment implements View.OnClickListener {
    Toolbar toolbar;
    private LinearLayout information;
    private LinearLayout collection;
    private LinearLayout help;
    private LinearLayout feedback;
    private ImageView vip;

    @Override
    protected void initView(View view) {
        super.initView(view);

    }

    @Override
    protected int setMainContent() {
        return R.layout.fragment_my;
    }

    public static Fragment newInstance() {
        MyFragment myFragment = new MyFragment();
        return myFragment;
    }

    @Override
    public void onViewCreated(@android.support.annotation.NonNull View view, @android.support.annotation.Nullable android.os.Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        setToolbarVisible(View.VISIBLE);
        setTitle("我的");
        setToolBarLeftImage(View.VISIBLE, R.drawable.msg_black);
        setToolBarRightImage(View.VISIBLE, R.drawable.setting);
        setToolBarRightText(View.GONE, "");

        information = (view).findViewById(R.id.information);
        collection = (view).findViewById(R.id.collection);
        help = (view).findViewById(R.id.help);
        feedback = (view).findViewById(R.id.feedbeck);
        vip = (view).findViewById(R.id.vip);

        information.setOnClickListener(this);
        collection.setOnClickListener(this);
        help.setOnClickListener(this);
        feedback.setOnClickListener(this);
        vip.setOnClickListener(this);
    }
    @Override
    protected void setRightImgClick() {
        Intent intent = new Intent(getActivity(), SettingActivity.class);
        startActivity(intent);
    }


    @Override
    protected void initToolbar(View view) {
        super.initToolbar(view);
        toolbar = (view).findViewById(R.id.toolbar);

        toolbar.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.information:
                showToastLong("information");
                startAct(InformationActivity.class);
                break;
            case R.id.collection:
                showToastLong("collection");
                break;
            case R.id.help:
                showToastLong("help");
                startAct(HelpActivity.class);
                break;
            case R.id.feedbeck:
                showToastLong("feedbeck");
                startAct(FeedbackActivity.class);
                break;
            case R.id.vip:
                showToastLong("vip");
                startAct(VipActivity.class);
                break;
            default:
                return;
        }
    }

}
